package com.starbaba.weixin.service.impl;

import com.starbaba.weixin.dao.WeixinQRDao;
import com.starbaba.weixin.model.QueryListVO;
import com.starbaba.weixin.model.WeixinActivityRedpackListVO;
import com.starbaba.weixin.service.WeixinActivityRedpackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Yukinomiu
 * @version 1.0
 */
@Service("WeixinActivityRedpackServiceImpl")
public class WeixinActivityRedpackServiceImpl implements WeixinActivityRedpackService {

    @SuppressWarnings("SpringJavaAutowiringInspection")
    @Autowired
    private WeixinQRDao weixinQRDao;

    @Override
    public QueryListVO getRecord(Map<String, Object> params) {
        Integer count = weixinQRDao.getRedpackActivityRecordCount(params);
        List<WeixinActivityRedpackListVO> data = null;
        if (count != 0) {
            data = weixinQRDao.getRedpackActivityRecord(params);
        }
        return new QueryListVO(count, data);
    }
}
